<?php

class AdminController extends Asd_Controller
{

    public function init()
    {
        parent::init();
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        $this->view->title = 'Колдонуучулар тизмеси';
        if (Zend_Auth::getInstance()->hasIdentity()) {
            $users = new Application_Model_Users();
            $this->view->users = $users->getAllUsers();
        }
    }

    public function inputprobAction()
    {
        $this->view->title = 'Маселе киргизүү';
        $form = new Application_Form_ProblemInput();
        
        if ($this->_request->isPost()){
            $data = $this->_request->getPost();
            if ($form->isValid($data)){
                var_dump($data); exit();
                $problem = new Application_Model_Problems();
                $problem->fill($data);
                
                $problem->save();
            }
        }
        $this->view->form = $form;
    }
    
    public function inputolympAction()
    {
        $this->view->title = 'Олимпиада киргизүү';
        $form = new Application_Form_ProblemInput();
        
        if ($this->_request->isPost()){
            $data = $this->_request->getPost();
            if ($form->isValid($data)){
                var_dump($data); exit();
                $problem = new Application_Model_Problems();
                $problem->fill($data);
                
                $problem->save();
            }
        }
        $this->view->form = $form;
    }
    
    public function inputalgoAction()
    {
        $this->view->title = 'Алгоритм киргизүү';
        $form = new Application_Form_ProblemInput();
        
        if ($this->_request->isPost()){
            $data = $this->_request->getPost();
            if ($form->isValid($data)){
                var_dump($data); exit();
                $problem = new Application_Model_Problems();
                $problem->fill($data);
                
                $problem->save();
            }
        }
        $this->view->form = $form;
    }
}





